﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mjollnir;
using System.Linq;

namespace Test.Mjollnir
{
    [TestClass]
    public class ByteArrayFactoryTest
    {
        [TestMethod]
        public void CreateTest1()
        {
            var array = Enumerable.Range(1, 10).Select(_ => (byte)_).ToArray();

            var expected = array;
            var actual = ByteArrayFactory.Create(stream =>
            {
                stream.Write(array, 0, array.Length);
            });

            Assert.AreEqual(expected.Length, actual.Length);

            for (var i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
    }
}
